package wafa.criterion;

import java.util.Iterator;
import java.util.List;

import com.ibm.mm.sdk.common.DKException;

import wafa.modelDocument.Document;
import wafa.modelDocument.Index;

public class TestCriterion {
	public static void main(String[] args) {
		
			CriteriaECMIBM criteria = new CriteriaECMIBM();
			criteria.setFamily("WASSIL");
			criteria.add(Restriction.allDocument());
			List<Document> listDocument = null;
			try {
				listDocument = criteria.excuteQuery("10");
			} catch (DKException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			Iterator<Document> itarator1 = listDocument.iterator();
			Document document = null;
			System.out.println(".........." + listDocument.size());

			while (itarator1.hasNext()) {
				System.out
						.println("-----------------------APRES-----------------------");
				document = (Document) itarator1.next();

				System.out.println("PID : " + document.getDocumentId());
				System.out.println("FAMILY : "
						+ document.getFamily().getFamilyName());
				Iterator<Index<?>> itarator2 = document.getIndexes().iterator();
				while (itarator2.hasNext()) {
					Index<?> index = (Index<?>) itarator2.next();
					System.out.println(index.getKey() + " : "
							+ index.getValue());
				}
				System.out.println(document.getContent().getMimeType());
				System.out.println("contenu"+ document.getContent().getContent() );

			}
			
	}
}
